# 作者：胡齐威
# 开发时间：2023/9/3 21:22
from sklearn.model_selection import KFold, LeaveOneOut

# K 折交叉验证
data=[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
kf = KFold(n_splits=10)
print("K折交叉验证法")
for train, test in kf.split(data):
    print("%s%s" % (train, test))

print("留一法")
loo = LeaveOneOut()
for train, test in loo.split(data):
    print("%s%s" %(train, test))